package com.scoy.honeymei.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;

import com.scoy.honeymei.R;
import com.scoy.honeymei.adapter.tabadapter.OyAdapter;
import com.scoy.honeymei.bean.FilmBean;
import com.scoy.honeymei.bean.TravelBean;
import com.scoy.honeymei.bean.TravelTypeBean;
import com.scoy.honeymei.databinding.ItemFilmnewVBinding;
import com.scoy.honeymei.databinding.ItemTravelLeftBinding;
import com.scoy.honeymei.utils.GlideImgUtil;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @ClassName: NormalAdapter$
 * @Description:
 * @Author: GaoZhan
 * @CreateDate: 2019/8/26/0026$ 下午 17:03$
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/8/26/0026$ 下午 17:03$
 * @UpdateRemark: 更新内容
 */
public class TravelLeftAdapter extends OyAdapter<TravelTypeBean> {


    public TravelLeftAdapter(Context context) {
        super(context);
    }

    @NonNull
    @NotNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
        ItemTravelLeftBinding binding = ItemTravelLeftBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
        return new OyHolder(binding);
    }

    @Override
    public void onBindViewHolder(@NonNull @NotNull RecyclerView.ViewHolder holder, int position) {
        OyHolder mHolder = (OyHolder) holder;
        TravelTypeBean mBean = datalist.get(position);
        mHolder.binding.itlTv.setText(mBean.getName());

        mHolder.binding.itlTv.setSelected(mBean.getCheck() == 1);
        mHolder.itemView.setSelected(mBean.getCheck() == 1);

        mHolder.itemView.setOnClickListener(view -> {
            if (onOneClick != null) {
                onOneClick.oneClick(position);
            }
        });

    }

    static class OyHolder extends RecyclerView.ViewHolder {
        private ItemTravelLeftBinding binding;

        public OyHolder(ItemTravelLeftBinding binding) {
            super(binding.getRoot());
            this.binding = binding;
        }
    }

}

